#include <iostream>
#include <string>
using namespace std;

int main()
{
    string str1;
    string str2;
    getline(cin, str1);
    getline(cin, str2);
    bool hash[300] = { 0 };
    for (auto e : str2)
    {
        hash[e] = true;
    }
    string ret;
    for (auto x : str1)
    {
        if (!hash[x])
        {
            ret += x;
        }
    }
    cout << ret << endl;
    return 0;
}


/*
struct ListNode {
    int val;
    struct ListNode *next;
    ListNode(int x) :
            val(x), next(NULL) {
    }
};*/
class Solution {
public:
    ListNode* FindFirstCommonNode(ListNode* pHead1, ListNode* pHead2)
    {
        ListNode* cur1 = pHead1;
        ListNode* cur2 = pHead2;

        while (cur1 != cur2)
        {
            cur1 = cur1 != nullptr ? cur1->next : pHead1;
            cur2 = cur2 != nullptr ? cur2->next : pHead2;
        }

        return cur1;
    }
};


#include <iostream>
#include <string>
using namespace std;
int main()
{
    int n;
    string str;
    cin >> n;
    cin >> str;
    long long s = 0, h = 0, y = 0;
    for (auto e : str)
    {
        if (e == 's') s += 1;
        else if (e == 'h')  h += s;
        else if (e == 'y') y += h;
    }

    cout << y << endl;
    return 0;
}